#include <stdio.h>
#include "strset.h"
#include "time_keeper.h"

#define lz_max 256

static void vApply(char *str, void *cl);

int main(int argc, char **argv)
{
	FILE * pFile;
	char lz_str [lz_max];
	int *cl=0;

//PART 1	
	Strset_T lstset=Strset_new();
	pFile = fopen (argv[1] ,"r");
	//evaluate time
	start_time();
	if (pFile==NULL) perror ("Error opening file");
	else{
    		while (fgets (lz_str , sizeof(lz_str) , pFile) != NULL) {
			Strset_add(lstset, lz_str);
      		}
    	fclose (pFile);
  	}
	Strset_foreach(lstset, vApply, &cl);
	wrt_time();
	printf("Test: %d\n", cl);
	Strset_free(&lstset);
	
	fflush(pFile);
}

static void vApply(char *str, void *cl)
{	
	int *p;
	p = (int*)cl;
	(*p)++;
}
